#include "capture.h"
#include "dial.h"
#include "onu_comm.h"

extern thread_pool_t *Tpool;

void* tcp_ping_task(void* arg)
{

    dial_arg_t dial_arg = { 0 };
    dial_result_t* dial_result;

    dial_arg.bridge_mode = 0;
    // dial_arg.in.tcpping_arg.ip = inet_addr("220.181.112.244");
    dial_arg.in.tcpping_arg.ip = inet_addr("10.0.2.23");
    dial_arg.in.tcpping_arg.port = htons(80);
    dial_arg.in.tcpping_arg.timeout = 2;
    dial_arg.in.tcpping_arg.counts = 10;
    dial_result = (dial_result_t*)dial_tcpping(&dial_arg);
    tcpping_result_print(&dial_result->out.tcpping_result);
    free(dial_result);

    return NULL;
}

int tcp_ping_conn_task_init(int argc, char** argv)
{
    thread_pool_add_task(Tpool, tcp_ping_task, NULL);
    return 0;
}
